package com.jtjrenren.android.taxi.driver.core.user.login;

import com.jtjrenren.android.taxi.driver.bean.DriverInfo;
import com.jtjrenren.android.taxi.driver.bean.event.DriverTypeEvent;
import com.jtjrenren.android.taxi.driver.bean.event.LoginEvent;
import com.jtjrenren.android.taxi.driver.manger.api.ApiWorks;


import org.greenrobot.eventbus.EventBus;

/**
 * Created by Administrator on 2016/8/18.
 */

public class LoginInterctorImpl implements LoginInterctor {
    @Override
    public void login(String phone, String pwd) {
        ApiWorks.login(phone, pwd, new ApiWorks.ResponseListener<DriverInfo>() {
            @Override
            public void onResponse(DriverInfo driverInfo) {
                EventBus.getDefault().post(new LoginEvent(driverInfo));
            }
        });
    }

    @Override
    public void getDriverType(String driverID) {
        ApiWorks.getCarType(driverID, new ApiWorks.ResponseListener<DriverInfo>() {
            @Override
            public void onResponse(DriverInfo driverInfo) {
                EventBus.getDefault().post(new DriverTypeEvent(driverInfo));
            }
        });
    }

}
